/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package frmsystem;

import java.util.Date;


import frmsystem.util.SystemConstants;

/**
 *
 * @author bahria
 */
public class Creator implements ICreator{

	@Override
	public IEntry createTransaction(IParty party, IAccount account, int transactionType, double amount) {
		Entry entry = null;
		if (transactionType==SystemConstants.TRANSACTION_BASIC) {
			entry = new Entry(account);
			entry.setAmount(amount);
			entry.setDate(new Date());
			entry.setType(SystemConstants.TRANSACTION_BASIC);
		}
		
		return entry;
	}

	@Override
	public IParty createOrganization(String name, String street, String city,
			String state, String zip, String email, int noOfEmp) {
		Organisation org = new Organisation();
		org.setCity(city);
		org.setEmail(email);
		org.setName(name);
		org.setNo_of_employees(noOfEmp);
		org.setState(state);
		org.setStreet(street);
		org.setZip(zip);
		org.setType(SystemConstants.PARTY_ORGANIZATION);
		
		return org;
	}

	@Override
	public IParty createPerson(String name, String street, String city,
			String state, String zip, String email, String birthDate) {
		Person org = new Person();
		org.setCity(city);
		org.setEmail(email);
		org.setName(name);
		org.setBirthDate(birthDate);
		org.setState(state);
		org.setStreet(street);
		org.setZip(zip);
		org.setType(SystemConstants.PARTY_PERSON);
		
		return org;
		
	}

	@Override
	public IAccount createAccount(String accountNo, int accType) {
		if(accType==SystemConstants.ACCOUNT_BASIC){
			Account acc = new Account();
			acc.setAccountNo(accountNo);
			acc.setInterestRate(14.5f);
			acc.setCurrentAmmount(0);
			return acc;
		}
		
		return null;
	}

}
